// 封装与文章相关的所有请求
import { getAction, postAction, request } from '@/utils'
// 获取频道下拉框数据
const getChannelListApi = () => {
    return getAction('/channels')
}
// 发布文章接口
const createArticleApi = (data)=>{
    return postAction('mp/articles?draft=false', data)
}
// 获取文章列表
const getArticleListApi = (data)=>{
    return getAction('mp/articles', data)
}
// 删除文章接口
const deleteArticleApi = (id)=>{
    return request({
        url: `mp/articles/${id}`,
        method: 'DELETE'
    })
}
// 获取文章详情接口
const getArticleDetailApi = (id)=>{
    return getAction(`mp/articles/${id}` )
    // return request({
    //     url: `mp/articles/${id}`,
    //     method: 'GET'
    // })
}
// 编辑文章接口
const editArticleApi = (data)=>{
    return request({
        url: `mp/articles/${data.id}`,
        method: 'PUT',
        data
    })
}
export { getChannelListApi, createArticleApi, getArticleListApi, deleteArticleApi, getArticleDetailApi, editArticleApi }